#include "Rectangle.h"

CRectangle::CRectangle(int top, int left, int bottom, int right):m_top(top), m_left(left), m_bottom(bottom), 
	m_right(right){}

CRectangle::~CRectangle(){}

void CRectangle::setTop(int top)
{
	m_top=top;
}

void CRectangle::setLeft(int left)
{
	m_left=left;
}

void CRectangle::setBottom(int bottom)
{
	m_bottom=bottom;
}

void CRectangle::setRight(int right)
{
	m_right=right;
}

int CRectangle::getTop()const
{
	return m_top;
}

int CRectangle::getLeft()const
{
	return m_left;
}

int CRectangle::getBottom()const
{
	return m_bottom;
}

int CRectangle::getRight()const
{
	return m_right;
}

void CRectangle::translate(const CVector2i& translationVector)
{
	m_top+=translationVector.getY();
	m_bottom+=translationVector.getY();
	m_left+=translationVector.getX();
	m_right+=translationVector.getX();
}

bool CRectangle::intersectWith(CRectangle otherRectangle)
{
	if((m_right<otherRectangle.getLeft()) || (m_left>otherRectangle.getRight()) ||
		(m_bottom<otherRectangle.getTop()) || (m_top>otherRectangle.getBottom()) )
	{
		return false;
	}
	else
	{
		return true;
	}
}
